<?php
include( "config.php" );
include( "Lib/Mysql.php" );
include( "Lib/License.php" );


function checkLicense( $license_key,$base_url,$product_code )
{
	$license = new License;
	return $license->checkLicense( $license_key,$base_url,$product_code );
}

function applyLicense( $base_url,$product_code )
{
	$license = new License;
	
	if( $my_license = $license->licenseExist( $base_url,$product_code ) ){
		return $my_license['license'];
	}else
		return $license->applyLicense( $base_url,$product_code );
}
//echo checkLicense("863190e8e083bda4d22712fb8dff3f9d","https:///www.tomyoyo.com/hello/",'magicimport');
//echo applyLicense("https:///www.tomyoyo.com/hello/",'magicimport');
$soap = new SoapServer(null,array('uri'=>"http://license.uplai.com/"));
$soap->addFunction(array('checkLicense','applyLicense'));
$soap->handle();